package com.deyuanyun.pic.pipe.support.validatefun;

import com.caixu.beanvalidateutil.vinterface.ValidateInterface;
import com.deyuanyun.pic.common.util.ObjectUtil;
import com.deyuanyun.pic.domain.pipe.PipeLine;
import com.deyuanyun.pic.pipe.support.utils.PipeDictUtils;

public class PipeLineValidata implements ValidateInterface {

	@Override
	public <T, E,C> boolean apply(T t, E e,C c) {
		if(ObjectUtil.isNotNullEmpty(t)){
			String lineId= PipeDictUtils.getLineIdByName(((String) t).trim());
			if(lineId != null)
			{
				PipeLine pipeLine = PipeDictUtils.getLineById(lineId);
				if ("1".equals(pipeLine.getState())){
					return false;
				}
				return true;
			}
			return false;
		}
		return true;
	}

	@Override
	public String getName() {
		return null;
	}

}
